package com.atguigu.bean;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
@Data
//indexName:索引库名   shards分片数量    replicas副本数量
@Document(indexName = "user",shards = 3 , replicas = 2)
public class User {
    @Id
    private String id;
    @Field(name = "name" , type = FieldType.Text , analyzer = "ik_max_word")
    private String name;
    @Field(name = "age" , type = FieldType.Integer)
    private Integer age;
    @Field(name = "salary" , type = FieldType.Double)
    private Double salary;
    //DateFormat.date指定  日期时间格式为yyyy-MM-dd
    @Field(name = "birthday" , type = FieldType.Date, format = DateFormat.date)
    private Date birthday;



}
